﻿
/**
*钥匙
*/
Chenxin.UI.KeyForm = Chenxin.extend(Chenxin.UI.FormCommon, {
    actionUrl: 'service/keyAddHandler.ashx',
    id: 'keyWin',
    renderTo: 'jqm_key',
	defBBtn:true,
    initFormValidator: function() {
        var _this = this;
        //验证
        $.formValidator.initConfig({ validatorgroup: this.id, formid: "form_keyAdd", onerror: function(msg) { alert(msg) }, onsuccess: function() { return true; } });
        $("#keyAddNumber").formValidator({ validatorgroup: this.id,
            onshow: "输入数量", onfocus: "输入数量", oncorrect: " "
        }).inputValidator({
            min: 1, empty: { leftempty: false, rightempty: false, emptyerror: "数量不能为空！" }, onerror: "数量不能为空！"
        }).functionValidator({ //数字验证
            fun: function(val, elem) { return val.isNum(); }, onerror: "请输入数字"
        });

        $("#keyAddDate").focus(function() {
            WdatePicker({ oncleared: function() { $(this).blur(); }, onpicked: function() { $(this).blur(); } })
        }).formValidator({ validatorgroup: this.id,
            onshow: "请输入日期！",
            onfocus: "请输入日期",
            oncorrect: " "
        }).inputValidator({
            empty: { leftempty: false, rightempty: false, emptyerror: "时间不能为空!" },
            type: "date",
            onerror: "时间不能为空"
        });

        $("#keyAddCode").formValidator({ validatorgroup: this.id,
            onshow: "输入编号", onfocus: "输入编号", oncorrect: "输入正确"
        }).inputValidator({
            min: 1, empty: { leftempty: false, rightempty: false, emptyerror: "编号不能为空！" }, onerror: "编号不能为空！"
        });
    },
    createForm: function() {
        //return formCommon.houseKeyForm('key');
        return Chenxin.FormCommon.houseKeyForm('key');
    },
    initEvent: function() {
        var _this = this;
        $('#key_Save').live('click', function() {
            _this.save();
        });
        $('#key_Cancle').live('click', function() {
            _this.hide();
        });
    },
    initComponent: function() {
        Chenxin.UI.KeyForm.superclass.initComponent.call(this);
    }
});

 /**

    /**
    *@description 钥匙
    *@comboIdPrefix DIV下拉框和提交按钮前缀
    */
Chenxin.FormCommon.houseKeyForm=function(comboIdPrefix) {
    return '<table class="tbl_f jqTabWh" ><tbody> <tr><th style="width:100px; height:25px;">房源编号：</th><td style="width:440px;" ><input type="text" name="HouseCode" readonly="readonly" class="inputbox_n"/></td></tr><tr><th style="width:100px; height:25px;">地址：</th><td><input type="text" name="Address" readonly="readonly" class="inputbox_n"/></td></tr><tr><th style="width:100px; height:25px;">所属人员：</th> <td><input type="text" name="AddPerson" class="inputbox_n" readonly="readonly" /></td></tr><tr><th style="width:100px; height:25px;">所属门店：</th> <td><input type="text" name="AddDepart" class="inputbox_n" readonly="readonly" /></td></tr>  <tr> <th>钥匙编号：</th><td> <div style="float:left"><input name="ReceiptionCode" type="text" class="inputbox_n"  maxlength="12" id="keyAddCode" /></div><div style="float:left" id="keyAddCodeTip"></div></td> </tr>  <tr><th>钥匙数量：</th><td> <div style="float:left"><input name="KeyCount" type="text" id="keyAddNumber" class="inputbox_n"  maxlength="3" style="width:60px;" /></div> <div style="float:left" id="keyAddNumberTip"></div></td>  </tr>  <tr> <th>收取日期：</th><td><input name="GetKeyDay" type="text" id="keyAddDate"  readonly="readonly" class="inputbox_n" style="width:100px;"/></td></tr></tbody></table>';
};
